package com.beverages.messages.client;

import com.beverages.messages.common.Result;
import com.beverages.messages.config.FeignOkHttpConfig;
import com.beverages.messages.entity.dto.intermediate.CustomerDTO;
import feign.Headers;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

@FeignClient(name = "merchant-individual-service", url = "${merchant.individual.service.url}", configuration = FeignOkHttpConfig.class)
public interface MerchantIndividualClient {

    @GetMapping("/merchant/individual/id/{customerId}")
    @Headers("X-Feign-Request: true")
    Result<CustomerDTO> getCustomerById(@PathVariable("customerId") Integer customerId);

    @GetMapping("/merchant/individual/refund")
    @Headers("X-Feign-Request: true")
    Result refundToCustomer(
            @RequestParam(name = "toCustomerId") Integer toCustomerId,
            @RequestParam(name = "amount") BigDecimal amount);
}
